#ifndef SHELF_H
#define SHELF_H

#include <QObject>
#include <QMutex>
#include <QVector>

class Shelf : public QObject
{
    Q_OBJECT
public:
    explicit Shelf(int maxSize, QObject *parent = 0);
    void takeBook(int pos);
    void putBook(int pos);
    void putNewBook(int pos);
    int tryWriteNewBook();
    int size();

signals:
    void newBook();
    
private:
    int maxSize;
    QMutex *mutex;
    QVector<QMutex*> books;
};

#endif // SHELF_H
